Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

437
Visualizações
Mqtt connection Failed- [ React native ]

I'm trying to connect and get the data from topic sent by sensor. Unfortunately the connection not working. in the console doesn't show no msg

Ps: I'm using react_native_mqtt lib and a port : 80

Any help is appreciated.

constructor(){
        super();
        this.onMessageArrived = this.onMessageArrived.bind(this)
        this.onConnectionLost = this.onConnectionLost.bind(this)
        this.onConnect = this.onConnect.bind(this)
        const client = new Paho.MQTT.Client(host, Number(port), clientID);
        client.onMessageArrived = this.onMessageArrived;
        client.onConnectionLost = this.onConnectionLost;
        client.connect({ 
          onSuccess: this.onConnect,
          useSSL: false,
          userName: "user",
          password: "pass",
          onFailure: this.onConnectionLost
    
        });
    
        this.state = {
          message: [''],
          client,
          messageToSend:'',
          isConnected: false,
        };
    
      }
      onConnect = () => {
        const { client } = this.state.client;
        console.log("Connected!!!!");
        client.subscribe(topic, () => {
          console.log('subscribe success topic1');
        });
        this.setState({isConnected: true, error: ''})
      };

After a few minute:

Android Running app on Android SDK built for x86
onConnectionLost:AMQJS0007E Socket error:undefined.
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda